package com.SunSoft.PhoneRemoteControl;

import android.app.Dialog;
import android.content.res.Resources;
import android.database.sqlite.SQLiteDatabase;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.lang.reflect.Field;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

final class dx
  implements View.OnClickListener
{
  public final void onClick(View paramView)
  {
    if ((this.b.getText().toString().length() > 1) && (MainControl.d) && ((Show_Control.a(this.b.getText().toString().substring(0, 2)) + 10) * 2 != this.b.getText().toString().length()))
      this.c.setText("编码长度错误");
    for (int i = 0; ; i = 1)
    {
      if (i != 0)
      {
        Object[] arrayOfObject;
        this.a.R[this.a.g] = this.d.getText().toString();
        this.a.Q[this.a.g] = this.b.getText().toString();
        this.a.S[this.a.g] = this.e.getText().toString();
        this.a.Q[this.a.g] = Show_Control.a(this.b.getText().toString(), 1);
        i = this.a.getResources().getIdentifier("but_" + Show_Control.a(this.a.g), "id", "com.SunSoft.PhoneRemoteControl");
        paramView = (Button)this.a.findViewById(i);
        if (this.a.B)
        {
          this.a.Y = this.a.R[this.a.g];
          if (paramView == null)
            break label660;
          paramView.setText(this.a.Y);
          if ((this.a.Y == null) || (this.a.Y.length() != 1))
            break label643;
          if (!(Pattern.compile("[0-9]*").matcher(this.a.Y).matches()))
            break label626;
          paramView.setTextAppearance(this.a.getApplicationContext(), 2131034132);
          paramView = new Object[5];
          paramView[0] = this.a.R[this.a.g];
          paramView[1] = this.a.Q[this.a.g];
          paramView[2] = this.a.S[this.a.g];
          paramView[3] = Show_Control.t(this.a);
          paramView[4] = Integer.valueOf(this.a.g);
          if (!(MainControl.d))
            break label795;
          Show_Control.u(this.a).execSQL("update button_data set dis_ch = ? ,code_str = ? ,dis_en = ? where define_ID = ? and order_id= ? ", paramView);
          this.a.V[this.a.g] = false;
          paramView = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()));
          arrayOfObject = new Object[2];
          arrayOfObject[0] = paramView;
          arrayOfObject[1] = String.valueOf(Show_Control.o(this.a));
          if (!(MainControl.d))
            break label811;
          Show_Control.u(this.a).execSQL("update control_list set update_time = ? where  ID= ? ", arrayOfObject);
        }
        while (true)
        {
          this.a.ae = "";
          this.a.af = "";
          try
          {
            while (true)
            {
              while (true)
              {
                while (true)
                {
                  while (true)
                  {
                    do
                    {
                      label643: label660: 
                      do
                        while (true)
                        {
                          while (true)
                          {
                            while (true)
                            {
                              paramView = this.a.j.getClass().getSuperclass().getDeclaredField("mShowing");
                              paramView.setAccessible(true);
                              paramView.set(this.a.j, Boolean.valueOf(true));
                              this.a.j.dismiss();
                              return;
                              this.a.Y = this.a.S[this.a.g];
                            }
                            label626: paramView.setTextAppearance(this.a.getApplicationContext(), 2131034133);
                          }
                          paramView.setTextAppearance(this.a.getApplicationContext(), 2131034133);
                        }
                      while (this.a.aD == null);
                      paramView = (Button)this.a.aD.findViewById(i);
                    }
                    while (paramView == null);
                    paramView.setText(this.a.Y);
                    if ((this.a.Y == null) || (this.a.Y.length() != 1))
                      break label778;
                    if (!(Pattern.compile("[0-9]*").matcher(this.a.Y).matches()))
                      break;
                    paramView.setTextAppearance(this.a.getApplicationContext(), 2131034132);
                  }
                  paramView.setTextAppearance(this.a.getApplicationContext(), 2131034133);
                }
                label778: paramView.setTextAppearance(this.a.getApplicationContext(), 2131034133);
              }
              label795: Show_Control.n(this.a).execSQL("update button_data set dis_ch = ? ,code_str = ? ,dis_en = ? where define_ID = ? and order_id= ? ", paramView);
            }
            label811: Show_Control.n(this.a).execSQL("update control_list set update_time = ? where  ID= ? ", arrayOfObject);
          }
          catch (SecurityException paramView)
          {
            paramView.printStackTrace();
            return;
          }
          catch (NoSuchFieldException paramView)
          {
            paramView.printStackTrace();
            return;
          }
          catch (IllegalArgumentException paramView)
          {
            paramView.printStackTrace();
            return;
          }
          catch (IllegalAccessException paramView)
          {
            paramView.printStackTrace();
            return;
          }
        }
      }
      try
      {
        paramView = this.a.j.getClass().getSuperclass().getDeclaredField("mShowing");
        paramView.setAccessible(true);
        paramView.set(this.a.j, Boolean.valueOf(false));
        return;
      }
      catch (SecurityException paramView)
      {
        paramView.printStackTrace();
        return;
      }
      catch (NoSuchFieldException paramView)
      {
        paramView.printStackTrace();
        return;
      }
      catch (IllegalArgumentException paramView)
      {
        paramView.printStackTrace();
        return;
      }
      catch (IllegalAccessException paramView)
      {
        paramView.printStackTrace();
        return;
      }
    }
  }
}